package com.ruoyi.web.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ruoyi.utils.ResponseResult;
import com.ruoyi.vo.AcupunctureTypeVo;
import org.apache.tomcat.util.http.ResponseUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import com.ruoyi.common.pms.entity.YytAcupunctureType;
import com.ruoyi.common.pms.service.YytAcupunctureTypeService;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
* <p>
    *  前端控制器
    * </p>
*
* @author MrPing
* @since 2022-03-22
*/
@RestController
@RequestMapping("/acupunctureType")
public class YytAcupunctureTypeController {

    @Autowired
    private YytAcupunctureTypeService yytAcupunctureTypeService;

    /**
     * 获取灸大夫首页所有数据
     * @return
     */
    @GetMapping("/getTypeList")
    public ResponseResult getTypeList(){

        List<AcupunctureTypeVo> typeList = yytAcupunctureTypeService.getTypeList();

        return ResponseResult.success(typeList);
    }


    /**
     * 根据条件查询单条数据
     * @param name
     * @return
     */
    @GetMapping("/search")
    public ResponseResult getSearchType(@RequestParam("name")String name){

        QueryWrapper<YytAcupunctureType> wrapper = new QueryWrapper<>();
        wrapper.like("name", name).notIn("father", 0);
        List<YytAcupunctureType> list = yytAcupunctureTypeService.list(wrapper);

        return ResponseResult.success(list);
    }

}
